+2004-03-08 Federico Mena Quintero <federico@ximian.com>
+
+ Patch "1a" from #136185, by Morten Welinder.
+
+ * gtk/gtkfilechooserdefault.c (get_file_info): Take in an argument
+ that says whether the caller just wants the display name.
+ (shortcuts_insert_path): We only want the name in the call to
+ get_file_info().
+
+ * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Don't request more
+ info than needed from the file_folder.
+
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Fixes #136105.
+2004-03-08 Federico Mena Quintero <federico@ximian.com>
+
+ Patch "1a" from #136185, by Morten Welinder.
+
+ * gtk/gtkfilechooserdefault.c (get_file_info): Take in an argument
+ that says whether the caller just wants the display name.
+ (shortcuts_insert_path): We only want the name in the call to
+ get_file_info().
+
+ * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Don't request more
+ info than needed from the file_folder.
+
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Fixes #136105.
+2004-03-08 Federico Mena Quintero <federico@ximian.com>
+
+ Patch "1a" from #136185, by Morten Welinder.
+
+ * gtk/gtkfilechooserdefault.c (get_file_info): Take in an argument
+ that says whether the caller just wants the display name.
+ (shortcuts_insert_path): We only want the name in the call to
+ get_file_info().
+
+ * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Don't request more
+ info than needed from the file_folder.
+
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Fixes #136105.
+2004-03-08 Federico Mena Quintero <federico@ximian.com>
+
+ Patch "1a" from #136185, by Morten Welinder.
+
+ * gtk/gtkfilechooserdefault.c (get_file_info): Take in an argument
+ that says whether the caller just wants the display name.
+ (shortcuts_insert_path): We only want the name in the call to
+ get_file_info().
+
+ * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Don't request more
+ info than needed from the file_folder.
+
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Fixes #136105.
+2004-03-08 Federico Mena Quintero <federico@ximian.com>
+
+ Patch "1a" from #136185, by Morten Welinder.
+
+ * gtk/gtkfilechooserdefault.c (get_file_info): Take in an argument
+ that says whether the caller just wants the display name.
+ (shortcuts_insert_path): We only want the name in the call to
+ get_file_info().
+
+ * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Don't request more
+ info than needed from the file_folder.
+
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Fixes #136105.
/* Convenience function to get the display name and icon info for a path */
static GtkFileInfo *
-get_file_info (GtkFileSystem *file_system, const GtkFilePath *path, GError **error)
+get_file_info (GtkFileSystem *file_system, const GtkFilePath *path, gboolean name_only, GError **error)
{
GtkFilePath *parent_path;
GtkFileFolder *parent_folder;
#if 0
| GTK_FILE_INFO_ICON
#endif
- | GTK_FILE_INFO_IS_FOLDER,
+ | (name_only ? 0 : GTK_FILE_INFO_IS_FOLDER),
error);
gtk_file_path_free (parent_path);
}
else
{
- GtkFileInfo *info;
-
- info = get_file_info (impl->file_system, path, error);
- if (!info)
- return FALSE;
-
- data = gtk_file_path_copy (path);
-
if (label)
label_copy = g_strdup (label);
else
- label_copy = g_strdup (gtk_file_info_get_display_name (info));
+ {
+ GtkFileInfo *info = get_file_info (impl->file_system, path, TRUE, error);
+ if (!info)
+ return FALSE;
+ label_copy = g_strdup (gtk_file_info_get_display_name (info));
+ gtk_file_info_free (info);
+ }
+ data = gtk_file_path_copy (path);
pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl), ICON_SIZE, NULL);
-
- gtk_file_info_free (info);
}
if (pos == -1)
return;
error = NULL;
- info = get_file_info (impl->file_system, path, &error);
+ info = get_file_info (impl->file_system, path, FALSE, &error);
if (!info)
error_getting_info_dialog (impl, path, error);
GError **error)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
- GError *err;
+ GtkFileInfo *info;
- err = NULL;
- if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, &err))
- {
- g_propagate_error (error, err);
- return FALSE;
- }
+ /* Test validity of path here. */
+ info = get_file_info (impl->file_system, path, FALSE, error);
+ if (!info)
+ return FALSE;
+ gtk_file_info_free (info);
+
+ if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, error))
+ return FALSE;
if (impl->current_folder != path)
{
impl->current_folder = gtk_file_path_copy (path);
}
- /* Update the widgets that may trigger a folder chnage themselves */
+ /* Update the widgets that may trigger a folder change themselves. */
if (!impl->changing_folder)
{
current_path = list;
break;
}
-
}
if (current_path)
result = TRUE;
+ /* Check whether the new path is already present in the pathbar as buttons.
+ * This could be a parent directory or a previous selected subdirectory.
+ */
if (gtk_path_bar_check_parent_path (path_bar, file_path, path_bar->file_system))
return TRUE;
-
+
path = gtk_file_path_copy (file_path);
gtk_widget_push_composite_child ();
GtkFilePath *parent_path = NULL;
GtkWidget *button;
const gchar *display_name;
- GError *err = NULL;
GtkFileFolder *file_folder;
GtkFileInfo *file_info;
gboolean valid;
- GtkFileInfoType needed = GTK_FILE_INFO_DISPLAY_NAME;
ButtonType button_type;
valid = gtk_file_system_get_parent (path_bar->file_system,
path,
&parent_path,
- &err);
+ error);
if (!valid)
{
result = FALSE;
- g_propagate_error (error, err);
gtk_file_path_free (path);
break;
}
- if (first_directory)
- needed |= GTK_FILE_INFO_IS_FOLDER;
-
- file_folder = gtk_file_system_get_folder
- (path_bar->file_system,
- parent_path ? parent_path : path,
- needed,
- NULL);
+ file_folder = gtk_file_system_get_folder (path_bar->file_system,
+ parent_path ? parent_path : path,
+ GTK_FILE_INFO_DISPLAY_NAME,
+ NULL);
+ file_info = gtk_file_folder_get_info (file_folder, path, error);
+ g_object_unref (file_folder);
- file_info = gtk_file_folder_get_info (file_folder, path, &err);
- if (!file_info || (first_directory && !gtk_file_info_get_is_folder (file_info)))
+ if (!file_info)
{
result = FALSE;
- g_propagate_error (error, err);
- if (file_info)
- gtk_file_info_free (file_info);
- g_object_unref (file_folder);
gtk_file_path_free (parent_path);
gtk_file_path_free (path);
break;
button = make_directory_button (path_bar, display_name, path, first_directory);
gtk_file_info_free (file_info);
gtk_file_path_free (path);
- g_object_unref (file_folder);
new_buttons = g_list_prepend (new_buttons, button);
button_type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "gtk-path-bar-button-type"));
if (button_type != NORMAL_BUTTON)
{
- if (parent_path)
- gtk_file_path_free (parent_path);
+ gtk_file_path_free (parent_path);
break;
}